package com.tom.service.impl;

import java.sql.SQLException;
import java.util.ArrayList;

import com.tom.util.HttpRequest;
import com.tom.util.JDBCUtil;

/***
 * 把京东获取的json数据入库
 * @author Tom
 *
 */
public class JDDetailImpl {
	
	public static void main(String[] args){
		ArrayList<String> list = new ArrayList<String>();
		for(int i = 0 ; i <= 100 ; i++){
			String url = "https://sclub.jd.com/comment/productPageComments.action?callback=&productId=1909100&score=0&sortType=6&page=--pageParam--&pageSize=10&isShadowSku=0&fold=1";
			url = url.replace("--pageParam--", i+"");
			System.err.println(url);
			String result = HttpRequest.sendGet(url);
			System.err.println(result);
			result = result.replace("'", "\\'");
			list.add(result);
		}
		try {
			JDBCUtil.insertJDJson(list, "jd_comment");
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}

}
